import Vue from 'vue'
import Vuex from 'vuex'
import { getItem, setItem } from '@/utils/storage.js'
Vue.use(Vuex)

// 声明常量以防touken名写错不报错
const TOKEN_KEY = 'userTouken'

export default new Vuex.Store({
  state: {
    userTouken: getItem(TOKEN_KEY)
  },
  mutations: {
    getUserTouken (state, token) {
      state.userTouken = token
      setItem(TOKEN_KEY, token)
    }
  },
  actions: {
  },
  modules: {
  }
})
